home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 8
/
Amoszine 8 (Disk 2 of 3).adf
/
Powerbobs.lha
/
powerbobsv1.0
/
demos
/
KillEm.asc
< prev
next >
Wrap
Text File
|
1995-06-30
|
5KB
|
202 lines
' Title: Kill'Em
' Author: PAUL OVERY
'
'Bank 14 = Gun shots
'Bank 15 = Men animation Frames
'
'-- Used by false mouse driver
Global DX,DY,OX,OY,RIGHT_CLICK,LEFT_CLICK,_X,_Y
'
'-- Used by game
Global MAN1$,MAN2$,SHOT$,DIE$,MEN
'
'-------------------------------------
Load "PowerBobsV1.0:DEMOS/KillEm.Abk"
'-------------------------------------
'
Proc _INTIALISE
Proc _SETUP_AMAL
'
Break Off
NUL=Execall(-132) : Rem -- Multitasking off
'
Repeat
'
Proc _MOUSE : Rem -- Need to update mouse, now that multitasking is off.
'
If LEFT_CLICK
'
Shoot
'
Amal 10,SHOT$ : Amal On 10 : Rem -- Animate blast
Amreg(10,0)=_X
Amreg(10,1)=_Y
'
'-- Has a man has been hit?
'
If Pspritebob Fastcol(1,1 To MEN)
'
C0L=Pfast Sprbobcol(-1) : Rem -- Find out which man has been hit.
If I Pbob(C0L)<65 : Rem -- Can't hit man while falling.
Amal C0L-1,DIE$
Amal On C0L-1 : Rem -- Animate death sequence.
End If
End If
End If
'
For K=0 To MEN-1
' -- Once a man has died, the value 666 is fed to the main program.
If Amreg(K,0)=666
' -- Animate a new man after a death.
If Rnd(1)=0
Amal K,MAN1$ : Rem -- Walk left
Else
Amal K,MAN2$ : Rem -- Walk left & down
End If
Amal On K : Rem -- Restart a new man moving.
End If
Next K
'
' -- Update all screen objects.
'
Psprite 0,_X,_Y,11 : Rem -- Draw Gun Sight
Psync Pbob 1 To MEN : Rem -- Pass Amal movements into Pbob
Psync Psprite 1 To 1 : Rem -- Pass Amal movements into Psprite
Psprite Update : Pbob Update : Rem -- Draw sprites & bobs
'
Screen Swap : Wait Vbl : Rem -- Flip new movements into view
'
Until RIGHT_CLICK
'
NUL=Execall(-138) : Rem -- Multitasking on.
Break On
'
Procedure _INTIALISE
'
Hide
Input "Number of men? [1..10] --> ";MEN
N=1
'
' Do not pre-store your bobs & sprites in bank 1.
' Its much better to cut them from a crunched picture bank.
'
' i.e.
'
' -- First cut out sprites
'
Unpack 14 To 0 : Rem -- show gun sight/shot gfx.
Screen Hide 0
For X=0 To 176 Step 16
Get Sprite N,X,0 To X+16,16
Inc N
Next X
'
'-- Convert sprite bank into new faster format.
'
Set Psprite Colours 4
Convert Sprites 1
Psprite Max 8
Erase 1
'
'-- Now cut out all the men.
'
N=1
Unpack 15 To 0 : Rem -- show men gfx
Screen Hide 0
For Y=0 To 308 Step 32
For X=0 To 288 Step 32
Get Bob N,X,Y To X+32,Y+32 : Inc N
Next X
Next Y
'
'-- Define what type of Pbob's you need.
'
Make Mask
Reserve Pbobs MEN
Pbob Dbuf True
For K=1 To MEN
Pbob Height K,32
Next K
'
'
Screen Open 0,320,256,16,Lowres : Screen Hide 0
Curs Off : Flash Off
'-- Draw bubble message.
'
Cls 6 : Pen 5 : Paper 6 : Print "Get'Em"
For Y=0 To 7
For X=0 To 50
If Point(X,Y)<>6
Circle X*6+20,Y*6+100,Rnd(2)+2
End If
Next X
Next Y
Get Sprite Palette
Pen 1 : Centre "Right to stop"
Sprite Update Off : Bob Update Off : Autoback 0 : Double Buffer
Screen Show 0
'
'-- Give sprites new colours, ie "RGB"
'
For K=17 To 27 Step 4
Colour K,$300 : Colour K+1,$A00 : Colour K+2,$F00
Next K
'
End Proc
Procedure _SETUP_AMAL
'
'-- Define all Amal programs
'
MAN2$="A 0,"
For K=1 To 32 : MAN2$=MAN2$+"("+Str$(K)+",2)" : Next K
MAN2$=MAN2$+"B: L X=Z(200)+132;L Y=-32;M -368,192,368;J B"
'
MAN1$="A 0,"
For K=33 To 64 : MAN1$=MAN1$+"("+Str$(K)+",2)" : Next K
MAN1$=MAN1$+"B: L X=336;L Y=Z(180)+32;M -368,0,368;J B"
'
DIE$="A 1,"
For K=65 To 96 : DIE$=DIE$+"("+Str$(K)+",2)" : Next K
DIE$=DIE$+"F R0=0 T 30;P;N R0;"
DIE$=DIE$+"F R0=0 T 6;L A=96;P;P;L A=97;P;P;N R0; L R0=666"
'
SHOT$="L X=R0; L Y=R1;A 1,"
For K=1 To 10 : SHOT$=SHOT$+"("+Str$(K)+",1)" : Next K
SHOT$=SHOT$+";P;P;P;P;P;P;P;P;P;P;L Y=0;L X=0"
'
'-- set up all Amal programs
'
For K=1 To MEN
Amal K-1,MAN1$
Pchannel To Pbob K-1 To K
Next K
'
Amal 10,SHOT$ : Pchannel To Psprite 10 To 1
'
'-- Run all Amal programs
'
Amal On
'
'-- Animate at full frame rate (50fps)
'
Psync Every Pbob 1 : Psync Every Psprite 1
'
End Proc
Procedure _MOUSE
'
'-- This updates "X mouse", "Y mouse" when multitaking is off.
'
Y_BYTE=Peek($DFF00A) : Rem like "x mouse" but only values 0-255
X_BYTE=Peek($DFF00B) : Rem like "y mouse" but only values 0-255
LEFT_CLICK= Not Btst(6,$BFE001)
RIGHT_CLICK= Not Btst(10,$DFF016)
DX=X_BYTE-OX : DY=Y_BYTE-OY : OX=X_BYTE : OY=Y_BYTE
If DX<-127 Then DX=256+DX
If DX>127 Then DX=DX-256
If DY<-127 Then DY=256+DY
If DY>127 Then DY=DY-256
_Y=Max(Min(_Y+DY,Y Hard(Screen Height-8)),40)
_X=Max(Min(_X+DX,X Hard(Screen Width-8)),120)
'
End Proc